<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title>
  <style>
    /* 屏幕宽度为640px的时候加载 */
    @media screen and (width: 640px) {
      html {
        font-size: 100px;
      }
    }
    /* 屏幕宽度为320px的时候加载 */
    @media screen and (width: 320px) {
      html {
        font-size: 50px;
      }
    }
    /* div中的单位都使用了rem 
    目的是宽高和字体大小可以随屏幕的改变而改变 */
    div {
      width: 2rem;
      height: 2rem;
      background-color: aqua;
      font-size: 0.28rem;
    }
  </style>
</head>
<body> <div>rem</div> </body> </html>